package com.zhong.gang.app.ui.examine.presenter;

import android.content.Context;
import android.text.TextUtils;

import com.zhong.gang.app.api.Api;
import com.zhong.gang.app.api.HttpUtils;
import com.zhong.gang.applib.base.act.ActBase;
import com.zhong.gang.applib.http.BaseDataBean;
import com.zhong.gang.applib.http.callback.Callback;
import com.zhong.gang.applib.http.callback.DataCallBack;

public class ExaminePresenter {
    /**
     * 审核列表
     *
     * @param context
     * @param current
     * @param type
     * @param status
     * @param callback
     */
    public void getList(Context context, int current, int type, int status, Callback callback) {
        HttpUtils.post(Api.auditList, context)
                 .addParams("current", current + "")
                 .addParams("size", "10")
                 .addParams("type", type + "")
                 .addParams("status", status + "")
                 .build().execute(callback);
    }


    public void getAuditOrderPayApply(Context context, int current, String searchKey, int payStatus,
            int auditStatus, int beyondLimitPrice, Callback callback) {
        HttpUtils.get(Api.ORDER_PAY_APPLY, context)
                 .addParams("current", String.valueOf(current))
                 .addParams("searchKey", searchKey)
                 .addParams("payStatus", String.valueOf(payStatus))
                 .addParams("auditStatus", String.valueOf(auditStatus))
                 .addParams("beyondLimitPrice", String.valueOf(beyondLimitPrice))
                 .build().execute(callback);


    }

    /**
     * 审核业务
     */
    public void auditExamine(ActBase actBase, int auditId, int status) {
        HttpUtils.post(Api.auditExamine, actBase)
                 .addParams("auditId", auditId + "")
                 .addParams("status", status + "")
                 .build().execute(actBase, "审核", new DataCallBack<BaseDataBean<String>>(actBase) {
            @Override
            public void onResponse(BaseDataBean<String> data) throws Exception {
                super.onResponse(data);
                actBase.closeActivity();
            }
        });
    }

    /**
     * 业务审核记录列表
     *
     * @param actBase
     * @param auditId
     */
    public void getDetail(ActBase actBase, int auditId, Callback callback) {
        HttpUtils.post(Api.getDetail, actBase)
                 .addParams("id", auditId + "")
                 .build().execute(callback);
    }

    /**
     * 业务审核记录列表
     *
     * @param actBase
     * @param auditId
     */
    public void recordList(ActBase actBase, int auditId, Callback callback) {
        HttpUtils.post(Api.recordList, actBase)
                 .addParams("auditId", auditId + "")
                 .build().execute(callback);
    }

    /**
     * 业务审核记录列表
     *
     * @param actBase
     * @param auditId
     */
    public void getMaterialTypePrice(ActBase actBase, int auditId, Callback callback) {
        HttpUtils.post(Api.materialTypePrice, actBase)
                 .addParams("id", auditId + "")
                 .build().execute(callback);
    }
}
